package com.fit.pages.manufacturer;

import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.annotations.Inject;

import com.fit.annotations.AdminAccess;
import com.fit.annotations.UserAccess;
import com.fit.dao.manufacturer.ManufacturerDAO;
import com.fit.dao.wholesale.WholesaleDAO;
import com.fit.entities.Manufacturer;
import com.fit.entities.Wholesale;

@AdminAccess
@UserAccess
public class Details {

	@Property
	@Persist
	private Manufacturer manufacturer;
	
	@Property
	@Persist
	private Wholesale wholesale;
	
	@Inject
	private WholesaleDAO wholesaleDAO;
	
	@Inject
	private ManufacturerDAO manufacturerDAO;
	
	public boolean isWholesaleNotNull(){
		if(manufacturer.getWholesale()!=null){
			return true;
		} else {
			return false;
		}
	}
	
	Object onActivate(Long id) {
		manufacturer = manufacturerDAO.findById(id);
		return null;

	}

}
